﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="companymap.aspx.cs" Inherits="weba.companymap" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <style type="text/css">
	html { height:100% }
	body { height:100%; margin:0px; padding:0px }
	   #container {
           height: 450px;
           width: 600px;
           float: left;
       }
            </style>
    <script type="text/javascript" src="Scripts/jquery-1.8.2.min.js"></script>
       <script type="text/javascript"
	src="http://webapi.amap.com/maps?v=1.2&key=ab5ae8097e26040fa604012b73e78f03">
</script>   
<script type="text/javascript">
    var ln;
    var point
    function raa() {

        // x=   WebService.HelloWorld();
        //  alert("adda");
        //  x = ln.getLng();
        //  var y = ln.getlnt();
        alert(x);

    }
    function a() {
        //  weba.wajax.HelloWorld(onresult);
        x = ln.getLng();
        y = ln.getLat();
        weba.wajax.xiougai(x, y, '<%= Request.QueryString["id"] %>', onresult)

    }
    function onresult(result) {
        alert(result);
    }
    function initialize() {
        jd = 121.559365;
        wd = 29.876755;
        var mapObj = new AMap.Map("container");
        mapObj.setZoom("18");
       // $("#tx").val("ln");
        // 创建地图实例
        if (jd == "") {
            point = new AMap.LngLat(121.550331, 29.868038); // 创建点坐标
        }
        else {
            point = new AMap.LngLat(jd, wd);
            var markera = new AMap.Marker({
                id: "m122",
                position: new AMap.LngLat(jd, wd),
                icon: "http://webapi.amap.com/static/images/marker_sprite.png",
                offset: { x: -8, y: -34 }
            });// 创建点坐标
            mapObj.addOverlays(markera);
        }

        //  alert(ln.getLng());

        // var point = new AMap.LngLat(116.404, 39.915); // 创建点坐标
        mapObj.setCenter(point); // 设置地图中心点坐标
        var info = [];
        info.push("<b>&nbsp;&nbsp;宁波中欣数码有限公司</b>");
        info.push("&nbsp;&nbsp;电话 :  0574-84107000   邮编 : 315016");
        info.push("&nbsp;&nbsp;地址 : 浙江省宁波市江北区扬善路36号玛瑙大厦F楼6楼");
        inforWindow = new AMap.InfoWindow({
            offset: new AMap.Pixel(0, -23),
        content:info.join("<br/>")  
        });

        inforWindow.open(mapObj, new AMap.LngLat(121.559365, 29.876755));

        mapObj.bind(mapObj, "click", function (e) {
            ln = e.lnglat;
            var marker = new AMap.Marker({
                id: "m123",
                position: e.lnglat,
                icon: "http://webapi.amap.com/static/images/marker_sprite.png",
                offset: { x: -8, y: -34 }
            });
            //  alert(ln.getLng());
            mapObj.addOverlays(marker);
            mapObj.setCenter(ln);
           // alert(ln);
            $("#tx").val(ln);
        });
    }

</script>
   
</head>
<body  onLoad="initialize()">
    <form id="form1" runat="server">
    <div>
     <div id="container"></div> 
       
    </div>
    </form>
</body>
</html>
